<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('货品绑定库位组')" />


<link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/css/font/iconfont.css}" media="all"/>
<link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/js/layui/css/layui.css}" media="all"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}" media="all"/>
<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
               <!-- <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <input type="hidden" th:value="${id}" id="id" name="id">
                </form>-->
                <div class="group-button" id="toolbar">
                 <a class="layui-btn layui-btn-sm layui-btn-normal add-btn">
                      <i class="layui-icon">&#x1005;</i> 添加
                  </a>
                </div>
                <input type="hidden" th:value="${id}" id="id" name="id">
                <!--列表-->
                <section class="panel panel-padding layui-card-body" >
                    <div class="pro">
                        <table id="table"  class="table text-nowrap" style="word-break:break-all; word-wrap:break-word;"></table>
                    </div>
                </section>

                <!--<div class="group-button" style="float:right;margin-bottom: 10px">
                    <a class="layui-btn layui-btn-sm layui-btn-normal closes">
                        <i class="layui-icon">&#x1005;</i> 保存
                    </a>
                    <a class="layui-btn layui-btn-sm layui-btn-normal closes">
                        <i class="layui-icon">&#x1005;</i> 取消
                    </a>
                </div>-->
            </div>
        </div>
    </div>
</div>


</body>
<script type="text/javascript" th:src="@{/plugin/layui/js/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/plugin/layui/js/version.js}"></script>
<script th:src="@{/plugin/layui/js/common.js}"></script>
<div th:include="public/public_js::public_js"></div>

<script>
    //	回车查询
    document.onkeydown = function(event) {
        e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            //执行的方法
            $('#search_button').click();
        }
    };
    layui.use(['list','layer','zzpUtils','jquery','laydate'],function () {
        window.operateEvent = {
            //预检
            "click .detail": function (e, value, row, index) {//增加地址

                console.info("增加地址");
                detail(row, index);
            },
            //删除
            "click .delete": function (e, value, row, index) {//增加地址

                console.info("增加地址");
                deletes(row, index);
            },

        }
        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery,
            layer = layui.layer,
            laydate = layui.laydate;

        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination: true,
            url: '/wmsgoods/seachGoodsBindingLibrarypositiongroup/'+$("#id").val(),
            method:'get',
            columns: [/*{
                field: '',
                checkbox: true
            },*/ {
                field: 'kwzmc',
                title: '库位组名称',
                align : 'center'
            }, {
                field: 'caozuo',
                title: '可用操作',
                align : 'center',
                events: operateEvent,
                formatter: operateFormatter
            }],
            queryParams: function () {//查询条件
                return zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (row, index) {
                return "这里就没有确定过11";
            },
            /*onDblClickRow: function (row, index) {//双击展示

            }*/

        });

        function operateFormatter(value, row, index) {
            return [
                '<a class="layui-btn layui-btn-xs layui-btn-radius layui-btn-warm  detail" >查看</a>',
                '<a class="layui-btn layui-btn-xs layui-btn-radius layui-btn-warm  delete" >删除</a>'

            ].join('')
        }

        function  detail( row, index){



              var  kwzid=row.kwzid;
              layer.open({
                  type: 2,
                  title: "查看库位",
                  content:"/zxsswms/goods/toGoodLibrary?kwzid=" + kwzid,
                  shade: [0.4, '#393D49'],
                  area: ['800px', '350px'],
                  success: function(layero, index){
                  }
                  ,btn: ['关闭']
                  ,yes: function(index, layero){
                      layer.close(index);
                  }

              })
        }

        function  deletes( row, index){
            var ids=[];
            ids.push(row.id);
            zzpUtils.confirm("确认删除",function (index) {
                zzpUtils.action({
                    url: "/wmsgoods/delectGoodsBindingLibrarypositiongroup",
                    data: JSON.stringify({ids:ids}),
                    success: function (data) {
                        setTimeout(function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            top.layer.msg(data.title + '<br>' + data.message);
                        }, 500);
                    }, error: function (xhr, textStatus) {
                        console.log(textStatus);
                        console.log(xhr)
                    }
                })
            })
        }

       //增加绑定库位组
        $(".add-btn").on('click',function () {
            var hpid = $("#id").val();
            layer.open({
                id: 'blindLibraryGroup',
                type: 2,
                title: "绑定库位组",
                content: "/zxsswms/goods/toBlindLibraryGroup?hpid=" + hpid,
                /* content: $("#libraryGrouo"),*/
                shade: [0.4, '#393D49'],
                area: ['900px', '450px'],
                success: function (layero, index) {

                }
                /* ,btn: ['保存','关闭']*/
                , yes: function (index, layero) {
                }
                , btn2: function (index, layero) {
                    layer.close(index);
                }


            })
        })

        //关闭
        $(".closes").on('click',function () {
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
        })


    })

</script>
        </html>